<template>
  <button @click="onChanged">点击</button>
</template>

<script setup>
import {ref, watchEffect} from 'vue';

const props = defineProps({
  data: {
    type: Object,
    default: ()=>{
      return {
        type: 'A'
      };
    }
  }
});
const emits = defineEmits(['configChanged'])

const data = ref({});

watchEffect(()=>{
  data.value = props.data;
});

const onChanged = () => {
  data.value.type = 'B';
  emits( 'configChanged', {config: data.value});
}
</script>
